package parser.nodes;

import codegen.ArrayDescr;
import codegen.CodeGen;
import codegen.RecordDescr;
import codegen.VarDescr;
import parser.TokenOr;
import scanner.Token;

public class ContNode extends DereferenceNode {

    public ContNode(Token identifier, SelectorNode selector) {
        super(identifier, selector);
    }
    
    @Override
    public void print() {
        p("Cont:");
        indent();
        p(identifier);
        unindent();
    }

    @Override
    public void abstractPrint() {
        p("cont");
        indent();
        p(identifier);
        selector.abstractPrint();
        unindent();
    }

    @Override
    public void compile(CodeGen c) throws CompileError {
        super.compile(c);
		if (lastSize > 0)
        c.outstr("CONT, " + lastSize);
    }   
	
	public DereferenceNode getSubstitution() {
		return new DereferenceNode(identifier, selector) {
			

			@Override
			public void print() {}

			@Override
			public void abstractPrint() {}
		};
	}
}
